package com.zr.serviceimpl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.ShowStationUserDao;
import com.zr.model.Crole;
import com.zr.model.Cuser;
import com.zr.service.ShowStationUserService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

@Service("showStationUserService")
public class ShowStationUserServiceImpl implements ShowStationUserService{

	@Resource
	private ShowStationUserDao showStationUserDao;
	
	@Override
	public JSONArray getAllUsers(int rid) {
		JSONArray js = new JSONArray();
		List<Cuser> rs = new ArrayList<Cuser>();
		rs = showStationUserDao.getAllUserByRid(rid);
		for (Cuser r : rs) {
			JSONObject j = new JSONObject();
			j.put("rid", r.getUid());
			j.put("rname", r.getUname());
			js.add(j);
		}
		return js;
	}

}
